package com.huluobo.mvvmdemo1903a.mvp.presenter;

import com.huluobo.mvvmdemo1903a.mvp.model.UserImpl;
import com.huluobo.mvvmdemo1903a.mvp.view.IMvpLoginView;

/**
 * Created by lc on 2021/11/22.
 */
public class LoginPresenter {
    private UserImpl userImpl;
    private IMvpLoginView iMvpLoginView;

    public LoginPresenter(IMvpLoginView iMvpLoginView) {
        this.iMvpLoginView = iMvpLoginView;
        this.userImpl = new UserImpl();
    }

    public void login() {
        String userName = iMvpLoginView.getUserName();
        String password = iMvpLoginView.getPassword();
        boolean isLoginSuccessful = userImpl.login(userName, password);
        iMvpLoginView.onLoginResult(isLoginSuccessful);
    }
}
